package com.validate.annotation.impl;

import com.validate.annotation.Null;
import com.validate.annotation.NullGroup;
import com.validate.annotation.ValidatorsGroupHandler;
import com.validate.annotation.ValidatorsHandler;

import java.lang.reflect.Field;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;


public class NullGroupControl implements ValidatorsGroupHandler{

	/**
	 * 字段
	 */
	@Override
	public ValidatorsHandler[] field(HashMap<String,ValidatorsHandler> handlerHashMap,Field f) {
		List<ValidatorsHandler> validatorsHandlers = new ArrayList<ValidatorsHandler>();
		NullGroup nullGroup  = f.getAnnotation(NullGroup.class);
		for (Null anull : nullGroup.value()){
			validatorsHandlers.add(handlerHashMap.get(Null.class.getName()));
		}
		ValidatorsHandler[] validatorsHandler = new ValidatorsHandler[]{};
		return validatorsHandlers.toArray(validatorsHandler);
	}

}
